extends ../layout
block content
    if(!lines.length)
        div.container.col-sm-8.col-sm-offset-3.alert.alert-warning(role="alert",style="margin-top: 80px;")
            strong 您暂时不能创建需求！
            | 需求只能在您加入的业务线下创建，您还未加入任何业务线，请联系产品经理把您加入业务线。
    if(lines.length)
        .container.col-md-offset-3.col-md-8(style="margin-top:50px")
            form.form-horizontal(id="defaultForm",role="form",method="post",action="/admin/issue")
                input(type="hidden",name="issue[creator]",value="#{issue.creator}")
                if issue._id
                    h3.page-header 编辑需求
                    input(type="hidden",name="issue[_id]",value=issue._id)
                else
                    h3.page-header 新建需求
                .form-group
                    label.col-sm-2.control-label 所属业务线
                    .col-sm-10
                        each line in lines
                            if issue.belongLineId == line.id
                                label.radio-inline
                                    input(type="radio",name="issue[belongLineId]",value=line._id,checked)
                                    | #{line.name}
                            else
                                label.radio-inline
                                    input(type="radio",name="issue[belongLineId]",value=line._id)
                                    | #{line.name}
                .form-group
                    label.col-sm-2.control-label 需求主题
                    .col-sm-10
                        input.form-control(type="text",name="issue[title]",value=issue.title)
                .form-group
                    label.col-sm-2.control-label 需求描述
                    .col-sm-10
                        textarea.form-control(type="text",cols="30",rows="4",name="issue[desc]",value=issue.desc) #{issue.desc}
                if issue._id
                    .form-group
                        label.col-sm-2.control-label(for="dtp_input3") 开始日期
                        .col-sm-5(data-link-field="dtp_input3")
                            input.datetimepicker.datetimepicker1.form-control(type="text",name="issue[start]",value="#{moment(issue.start).format('YYYY-MM-DD')}",readonly)
                    .form-group
                        label.col-sm-2.control-label(for="dtp_input4") 结束日期
                        .col-sm-5(data-link-field="dtp_input4")
                            input.datetimepicker.datetimepicker2.form-control(type="text",name="issue[end]",value="#{moment(issue.end).format('YYYY-MM-DD')}",readonly)
                else
                    .form-group
                        label.col-sm-2.control-label(for="dtp_input1") 开始日期
                        div.col-sm-5(data-link-field="dtp_input1")
                            input.datetimepicker.datetimepicker1.form-control(type="text",name="issue[start]",value=issue.start,readonly)
                    .form-group(for="dtp_input2")
                        label.col-sm-2.control-label 结束日期
                        .col-sm-5(data-link-field="dtp_input2")
                            input.datetimepicker.datetimepicker2.form-control(type="text",name="issue[end]",value=issue.end,readonly)
                .form-group
                    label.col-sm-2.control-label 需求状态
                    .col-sm-5
                        select(name="issue[condition]").form-control
                            if issue.condition == 0
                                option(value="0" selected) 需求分析中
                            else
                                option(value="0") 需求分析中
                            if issue.condition == 1
                                option(value="1" selected) PRD整理中
                            else
                                option(value="1") PRD整理中
                            if issue.condition == 2
                                option(value="2" selected) 原型设计中
                            else
                                option(value="2") 原型设计中
                            if issue.condition == 3
                                option(value="3" selected) 视觉稿设计中
                            else
                                option(value="3") 视觉稿设计中
                            if issue.condition == 4
                                option(value="4" selected) demo制作中
                            else
                                option(value="4") demo制作中
                            if issue.condition == 5
                                option(value="5" selected) 前后端联调中
                            else
                                option(value="5") 前后端联调中
                            if issue.condition == 6
                                option(value="6" selected) 测试中
                            else
                                option(value="6") 测试中
                            if issue.condition == 7
                                option(value="7" selected) 发布
                            else
                                option(value="7") 发布
                .form-group
                    label.col-sm-2.control-label 需求所需角色
                    .col-sm-10(style="margin-top:6px")
                        label.role-select
                            if (issue.role[0] == 0)
                                input(type="checkbox",name="issue[role]",value="0",checked)
                            else
                                input(type="checkbox",name="issue[role]",value="0")
                            span(style="margin-left:5px") PD
                        label.role-select
                            if (issue.role[0] == 1||issue.role[1] == 1)
                                input(style="margin-left:20px",type="checkbox",name="issue[role]",value="1",checked)
                            else
                                input(style="margin-left:20px",type="checkbox",name="issue[role]",value="1")
                            span(style="margin-left:5px") 交互
                        label.role-select
                            if (issue.role[0] == 2 ||issue.role[1] == 2||issue.role[2] == 2)
                                input(style="margin-left:20px",type="checkbox",name="issue[role]",value="2",checked)
                            else
                                input(style="margin-left:20px",type="checkbox",name="issue[role]",value="2")
                            span(style="margin-left:5px") 视觉
                        label.role-select
                            if (issue.role[0] == 3 ||issue.role[1] == 3||issue.role[2] == 3||issue.role[3] == 3)
                                input(style="margin-left:20px",type="checkbox",name="issue[role]",value="3",checked)
                            else
                                input(style="margin-left:20px",type="checkbox",name="issue[role]",value="3")
                            span(style="margin-left:5px") 前端
                        label.role-select
                            if (issue.role[0] == 4||issue.role[1] == 4||issue.role[2] == 4||issue.role[3] == 4||issue.role[4] == 4)
                                input(style="margin-left:20px",type="checkbox",name="issue[role]",value="4",checked)
                            else
                                input(style="margin-left:20px",type="checkbox",name="issue[role]",value="4")
                            span(style="margin-left:5px") 开发
                        label.role-select
                            if (issue.role[0] == 5||issue.role[1] == 5||issue.role[2] == 5||issue.role[3] == 5||issue.role[4] == 5||issue.role[5] == 5)
                                input(style="margin-left:20px",type="checkbox",name="issue[role]",value="5",checked)
                            else
                                input(style="margin-left:20px",type="checkbox",name="issue[role]",value="5")
                            span(style="margin-left:5px") 测试
                .form-group
                    .col-sm-offset-2.col-sm-10
                        button.postMsg.btn.btn-default(type="submit") 保存
    link(href="/libs/bootstrap/dist/css/bootstrap-datetimepicker.min.css",rel="stylesheet")
    link(href="/css/sweet-alert.css",rel="stylesheet")
    script(src="/js/sweet-alert.js")
    script(src="/libs/bootstrap/dist/js/bootstrap-datetimepicker.min.js")
    script(src="/libs/bootstrap/dist/js/bootstrapValidator.js")
    script(src="/js/issue-datetimepicker.js")
